$(function() {
	load_nursingCost_select();
	load_nursingCost_cond_select();
	
	_addChangeListener("#nursingCost_select", function() {
		var option = $('#nursingCost_select option:selected');
		if(view && view.data) {view.data.nursingCostName = option.text();}
	});
});

function load_nursingCost_select() {
	if($('#nursingCost_select').length==0) {return;}

	$('#nursingCost_select').html('<option value="" selected></option>');

	findAll_basic(path+'/nursingCost/findAll', function(response) {
		for(var i=0; i<response.data.length; i++) {
			$('#nursingCost_select').append('<option value="' + response.data[i].nursingCostId
				+ '">' + response.data[i].nursingCostName + ' ' + response.data[i].price + '元/月 '
				+ (response.data[i].price/2.0).toFixed(2) + '元/半个月'
				+ '</option>');
		}
	});
}

function load_nursingCost_cond_select() {
	if($('#nursingCost_cond_select').length==0) {return;}

	$('#nursingCost_cond_select').html('<option value="" selected></option>');

	findAll_basic(path+'/nursingCost/findAll', function(response) {
		for(var i=0; i<response.data.length; i++) {
			$('#nursingCost_cond_select').append('<option value="' + response.data[i].nursingCostId
				+ '">' + response.data[i].nursingCostName + ' ' + response.data[i].price + '元/月 '
				+ (response.data[i].price/2.0).toFixed(2) + '元/半个月'
				+ '</option>');
		}
	});
}
